import App from "./App.vue";
import { createSSRApp } from 'vue'
import Dictfilter from '@/utils/dict'
import modal from "@/utils/modal"
import NoneData from "@/components/none/data.vue"
import uviewPlus from "uview-plus";

const unity3dGlobal = () => {
	// #ifndef MP-WEIXIN
	window.mobile.jsCallUnity("")
	// #endif
	// #ifdef MP-WEIXIN
	uni.showToast({
		title: '请下载《荣耀殿堂》APP',
		icon: 'none'
	});
	// #endif
}

export function createApp() {
	const app = createSSRApp(App)
	const baseImgUrl = import.meta.env.VITE_APP_IMGURL
	const houseImgUrlPrefix = import.meta.env.VITE_APP_IMGURL_HOUSE
	const packageUserPath = '/package_user/pages/user'
	const packageLoginPath = '/package_login/pages/login'
	const packageTodoPath = '/package_todo/pages/todo'
	const packageHonourPath = '/package_honour/pages/honour'
	const packageKuaFuPath = '/package_kuafu_apartment/pages'
	const packageActivityPath = '/package_activity/pages'
	app.provide('packageUserPath', packageUserPath) // 分包- 用户包的前缀路径
	app.provide('packageLoginPath', packageLoginPath) // 分包- 登陆包的前缀路径
	app.provide('packageTodoPath', packageTodoPath) // 分包 - todo包的前缀路径
	app.provide('packageHonourPath', packageHonourPath) // 分包 - 荣誉库包前缀路径
	app.provide('packageKuaFuPath', packageKuaFuPath) // 分包 - 夸父公寓包前缀路径
	app.provide('baseImgUrl', baseImgUrl)
	app.provide('houseImgUrlPrefix', houseImgUrlPrefix)
	app.provide('packageActivityPath', packageActivityPath)
	app.provide('dict', Dictfilter);//字典库

	app.config.globalProperties.modal = modal;
	app.config.globalProperties.$unity3dGlobal = unity3dGlobal
	app.component('none-data', NoneData)
	app.use(uviewPlus)

	uni.$u.config.unit = 'rpx'
	return {
		app
	}
}

